home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: New Zealand Amiga Users Group / New Zealand Amiga Users Group Newsdisk v25 (1989-08)(NZAmigaUG).zip / New Zealand Amiga Users Group Newsdisk v25 (1989-08)(NZAmigaUG).adf / StrucBrowser / sb.src.zoo / SBWindow.c < prev   
C/C++ Source or Header  |  1988-06-22  |  8KB  |  202 lines

  1. /************************************************************************
  2. *                                    *
  3. *                SBWindow                *
  4. *                                    *
  5. *************************************************************************/
  6.  
  7. /* include not needed for Aztec C using provided makefile */
  8. #include "sb:sb.h"
  9. extern int level;
  10. extern void PrWindow2(), PrWindow3();
  11.  
  12.  
  13. void PrWindow(string, window) char *string; struct Window *window;
  14. {
  15. static struct StructData structdata[] = {
  16.      { " NextWindow",   "struct Window *",     5, PTRSIZE },
  17.      { "-LeftEdge",     "SHORT",               2, INTSIZE },
  18.      { "-TopEdge",      "SHORT",               2, INTSIZE },
  19.      { "-Width",        "SHORT",               2, INTSIZE },
  20.      { "-Height",       "SHORT",               2, INTSIZE },
  21.      { "-MouseY",       "SHORT",               2, INTSIZE },
  22.      { "-MouseX",       "SHORT",               2, INTSIZE },
  23.      { "-MinWidth",     "SHORT",               2, INTSIZE },
  24.      { "-MinHeight",    "SHORT",               2, INTSIZE },
  25.      { "-MaxWidth",     "SHORT",               2, INTSIZE },
  26.      { "-MaxHeight",    "SHORT",               2, INTSIZE },
  27.      { " Flags",        "ULONG",              11, PTRSIZE },
  28.      { "(MenuStrip",    "struct Menu *)",      5, PTRSIZE },
  29.      { " Title",        "UBYTE *",             4, PTRSIZE },
  30.      { "(FirstRequest", "struct Requester *)", 5, PTRSIZE },
  31.      { "(DMRequest",    "struct Requester *)", 5, PTRSIZE }
  32.   };
  33. static char *flagnames[32] = {
  34.      "WINDOWSIZING",    "WINDOWDRAG",   "WINDOWDEPTH",    "WINDOWCLOSE",
  35.      "SIZEBRIGHT",      "SIZEBOTTOM",   "SIMPLE_REFRESH", "OTHER_REFRESH",
  36.      "BACKDROP",        "REPORTMOUSE",  "GIMMEZEROZERO",  "BORDERLESS",
  37.      "ACTIVATE",        "WINDOWACTIVE", "INREQUEST",      "MENUSTATE",
  38.      "RMBTRAP",         "NOCAREREFRESH", NULL,            NULL,
  39.      NULL,              NULL,            NULL,            NULL,
  40.      "WINDOWREFRESH",   "WBENCHWINDOW",  "WINDOWTICKED"
  41.   };
  42. int sum, choice = -1;
  43. ULONG bits;
  44.   level++;
  45.   while (choice) {
  46.     sum = SetOptionText(string, structdata, (APTR)window, DATASIZE, 0);
  47.     switch (choice = GetChoice(MAXGADG + 1)) {
  48.       case 1:
  49.         if (window->NextWindow)
  50.           PrWindow("The next window in Intuition's list", window->NextWindow);
  51.         break;
  52.       case 12:
  53.         bits = window->Flags & ~SUPER_UNUSED;
  54.         switch ((bits & REFRESHBITS) >> 6) {
  55.           case 0:
  56.             flagnames[6] = "SMART_REFRESH";
  57.             bits |= 0x40;
  58.             break;
  59.           case 1:
  60.             flagnames[6] = "SIMPLE_REFRESH";
  61.             break;
  62.           case 2:
  63.             flagnames[7] = "SUPER_BITMAP";
  64.             break;
  65.           case 3:
  66.             flagnames[7] = "OTHER_REFRESH";
  67.             bits ^= 0x40;
  68.             break;
  69.         }
  70.         FlagPrint("Flags set in this window", flagnames, bits);
  71.         break;
  72.       case 14:
  73.         PrString("The Window's Title", window->Title);
  74.         break;
  75.       case MOREGADG:
  76.         PrWindow2("Window menbers (page 2)", window, sum);
  77.         break;
  78.     }
  79.   }
  80.   level--;
  81. }
  82.  
  83.  
  84. void PrWindow2(string, window, offset)
  85. char *string; struct Window *window; int offset;
  86. {
  87. static struct StructData structdata[] = {
  88.      { "-ReqCount",     "SHORT",               2, INTSIZE  },
  89.      { " WScreen",      "struct Screen *",     5, PTRSIZE  },
  90.      { " RPort",        "struct RastPort *",   5, PTRSIZE  },
  91.      { "-BorderLeft",   "BYTE",                3, BYTESIZE },
  92.      { "-BorderTop",    "BYTE",                3, BYTESIZE },
  93.      { "-BorderRight",  "BYTE",                3, BYTESIZE },
  94.      { "-BorderBottom", "BYTE",                3, BYTESIZE },
  95.      { " BorderRPort",  "struct RastPort *",   5, PTRSIZE  },
  96.      { " FirstGadget",  "struct Gadget *",     5, PTRSIZE  },
  97.      { " Parent",       "struct Window *",     5, PTRSIZE  },
  98.      { " Descendant",   "struct Window *",     5, PTRSIZE  },
  99.      { "(Pointer",      "USHORT *",            5, PTRSIZE  },
  100.      { "-PtrHeight",    "BYTE",                3, BYTESIZE },
  101.      { "-PtrWidth",     "BYTE",                3, BYTESIZE },
  102.      { "-XOffset",      "BYTE",                3, BYTESIZE },
  103.      { "-YOffset",      "BYTE",                3, BYTESIZE }
  104.   };
  105. int sum, choice = -1;
  106.   level++;
  107.   while (choice) {
  108.     sum = SetOptionText(string, structdata, (APTR)window, DATASIZE, offset);
  109.     switch (choice = GetChoice(MAXGADG + 1)) {
  110.       case 2:
  111.         if (window->WScreen)
  112.           PrScreen("The screen referenced in the window structure",
  113.              window->WScreen);
  114.         break;
  115.       case 3:
  116.         if (window->RPort)
  117.           PrRastPort("The window's RPort (RastPort)", window->RPort);
  118.         break;
  119.       case 8:
  120.         if (window->BorderRPort)
  121.           PrRastPort("The window's BorderRPort", window->BorderRPort);
  122.         break;
  123.       case 9:
  124.         if (window->FirstGadget)
  125.           PrGadget("The window's first gadget", window->FirstGadget);
  126.         break;
  127.       case 12:
  128.         printf("Sorry, selection not implemented\n\n");
  129.         break;
  130.       case 10:
  131.         if (window->Parent)
  132.           PrWindow("The 'parent' window", window->Parent);
  133.         break;
  134.       case 11:
  135.         if (window->Descendant)
  136.           PrWindow("The 'descendent' window", window->Descendant);
  137.         break;
  138.       case MOREGADG:
  139.         PrWindow3("Window members (page 3)", window, sum);
  140.         break;
  141.     }
  142.   }
  143.   level--;
  144. }
  145.  
  146.  
  147. void PrWindow3(string, window, offset)
  148. char *string; struct Window *window; int offset;
  149. {
  150. static struct StructData structdata[] = {
  151.      { " IDCMPFlags",   "ULONG",                  1, PTRSIZE  },
  152.      { " UserPort",     "struct MsgPort *",       5, PTRSIZE  },
  153.      { " WindowPort",   "struct MsgPort *",       5, PTRSIZE  },
  154.      { "(MessageKey",   "struct IntuiMessage *)", 5, PTRSIZE  },
  155.      { "-DetailPen",    "UBYTE",                 13, BYTESIZE },
  156.      { "-BlockPen",     "UBYTE",                 13, BYTESIZE },
  157.      { "(CheckMark",    "struct Image *)",        5, PTRSIZE  },
  158.      { " ScreenTitle",  "UBYTE",                  4, PTRSIZE  },
  159.      { "-GZZMouseX",    "SHORT",                  2, INTSIZE  },
  160.      { "-GZZMouseY",    "SHORT",                  2, INTSIZE  },
  161.      { "-GZZWidth",     "SHORT",                  2, INTSIZE  },
  162.      { "-GZZHeight",    "SHORT",                  2, INTSIZE  },
  163.      { "(ExtData",      "UBYTE *)",               5, PTRSIZE  },
  164.      { "(UserData",     "BYTE *)",                5, PTRSIZE  },
  165.      { "(WLayer",       "struct Layer *)",        5, PTRSIZE  }
  166.   };
  167. static char *IDCMPnames[32] = {
  168.      "SIZEVERIFY",     "NEWSIZE",       "REFRESHWINDOW",  "MOUSEBUTTONS",
  169.      "MOUSEMOVE",      "GADGETDOWN",    "GADGETUP",       "REQSET",
  170.      "MENUPICK",       "CLOSEWINDOW",   "RAWKEY",         "REQVERIFY",
  171.      "REQCLEAR",       "MENUVERIFY",    "NEWPREFS",       "DISKINSERTED",
  172.      "DISKREMOVED",    "WBENCHMESSAGE", "ACTIVATEWINDOW", "INACTIVEWINDOW",
  173.      "DELTAMOVE",      "VANILLAKEY",    "INTUITICKS",     NULL,
  174.      NULL,             NULL,            NULL,             NULL,
  175.      NULL,             NULL,            NULL,             "LONELYMESSAGE"
  176.   };
  177. int sum, choice = -1;
  178.   level++;
  179.   while (choice) {
  180.     sum = SetOptionText(string, structdata, (APTR)window, DATASIZE, offset);
  181.     switch (choice = GetChoice(DATASIZE)) {
  182.       case 1:
  183.         FlagPrint("IDCMP flags set in this window",
  184.               IDCMPnames, window->IDCMPFlags);
  185.         break;
  186.       case 2:
  187.         if (window->UserPort)
  188.           PrMsgPort("Window->UserPort",window->UserPort);
  189.         break;
  190.       case 3:
  191.         if (window->WindowPort)
  192.           PrMsgPort("Window->WindowPort",window->WindowPort);
  193.         break;
  194.       case 8:
  195.         PrString("The screen title when this window is activated",
  196.                  window->ScreenTitle);
  197.         break;
  198.     }
  199.   }
  200.   level--;
  201. }
  202.